package com.cjn.edu.web.controller;

import com.cjn.edu.module.User;
import com.cjn.edu.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("user")
public class UserController {
    @Autowired
    //自动检测spring配置中是不是有UserService，但是实际上是自动注入的，所以找不到
    //但是，运行时不会存在问题的
    protected IUserService userService;
    @RequestMapping("login")
    public String login(){
        System.out.println("......");
        return "Default";
    }
    @RequestMapping("manage")
    public String manage() {
        return "User/UserManage";
    }
    @RequestMapping("info")
    public String info() {
        return "User/UserInfo";
    }
    @RequestMapping("edit")
    public String edit() {
        return "User/UserEdit";
    }
    @RequestMapping("find")
    public String find(Integer id){
        System.out.println("......");
        User user = userService.findById(id);
        System.out.println(user);
        return null;
    }
}
